-
Notifications
You must be signed in to change notification settings - Fork 62
Update unassign-stale-issues.yml #142
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Conversation
✅ Deploy Preview for github-spy ready!
To edit notification comments on pull requests, go to your Netlify project configuration. |
WalkthroughThe workflow for unassigning stale issues was updated to determine staleness based on the time since the latest assignment event rather than issue creation. It fetches timeline events to identify assignment and pull request linkage dates, unassigning issues if no PR is linked within 7 days after assignment. The unassignment comment was revised accordingly. Changes
Estimated code review effort🎯 2 (Simple) | ⏱️ ~7 minutes Poem
Note ⚡️ Unit Test Generation is now available in beta!Learn more here, or try it out under "Finishing Touches" below. 📜 Recent review detailsConfiguration used: CodeRabbit UI 📒 Files selected for processing (1)
🚧 Files skipped from review as they are similar to previous changes (1)
✨ Finishing Touches🧪 Generate unit tests
🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
CodeRabbit Configuration File (
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (3)
.github/workflows/unassign-stale-issues.yml (3)
49-50: Broaden PR-link detection beyond theconnectedeventSome issues are linked to PRs via a cross-reference (
cross-referenced) rather than the “connected” event (e.g., using “Fixes #123” in the PR body).
Limiting the search toevent === 'connected'may yield false negatives and trigger unwarranted unassignments.-const prLinkedEvent = timeline.find(e => e.event === 'connected'); +const prLinkedEvent = timeline.find(e => + e.event === 'connected' || e.event === 'cross-referenced');Consider also checking
event.source.issue.pull_requestto confirm the reference is indeed a PR.
59-60: Guard-rail: treat “exactly 7 days” as within the grace periodThe comparison
prLinkedAt > assignedAt + 7 daysexcludes PRs linked exactly at the 7-day mark, which users may perceive as being “on time”.
Switch to>=when computing the unassignment threshold to make the rule inclusive and simpler to explain.-if (!prLinkedAt || prLinkedAt > new Date(assignedAt.getTime() + daysBeforeUnassign*24*60*60*1000)) { +if (!prLinkedAt || prLinkedAt >= new Date(assignedAt.getTime() + daysBeforeUnassign*24*60*60*1000)) {
22-38: Potential rate-limit hotspotFor every open, assigned issue you paginate all timeline events.
On large repos this can hit secondary rate limits quickly.
Two optimisations:
- Stop paginating once both a relevant assignment and PR-link event have been found.
- Switch to a GraphQL query that requests only
assigned,unassigned,connected, andcross-referencedevents in a single round-trip.Not urgent, but worth scheduling before repo traffic grows.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (3)
.github/workflows/unassign-stale-issues.yml (3)
39-41: Comment wording contradicts the codeThe inline comment says “Find the first assignment event date” but the code deliberately takes the latest assignment (
.at(-1)).
Update the comment to avoid confusion for future maintainers.
31-37: Potential rate-limit hit when paginating per-issue timelines
listEventsForTimelineis invoked for every open, assigned issue.
On repositories with hundreds of assigned issues this can exceed REST rate limits and slow the workflow.Consider batching with GraphQL (
search/issues, timeline items) or limiting the call set by first filtering issues whoseupdated_atis older than the 7-day window.
56-58: Minor: avoid recomputing the 7-day threshold in the hot pathThe expression creating a new
Dateinside the innerifallocates once per issue.
Calculateconst unassignThreshold = new Date(assignedAt.getTime() + daysBeforeUnassign * 864e5);once and reuse it to make the intent clearer and shave allocations.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Actionable comments posted: 1
🧹 Nitpick comments (2)
.github/workflows/unassign-stale-issues.yml (2)
39-41: Update comment to reflect “latest” assignment, not “first”.The code now correctly selects the last assignment event (
.at(-1)), but the inline comment still says “first assignment event date”.
This can easily mislead future maintainers.-// Find the first assignment event date +// Find the most recent assignment event date
31-37: Potential rate-limit risk when paging every issue’s full timeline.
listEventsForTimelineis invoked for every open, assigned issue; each call may need several paginated requests.
In repos with hundreds of active issues this easily consumes the REST API rate limit, causing the job to fail midway.Consider:
• Filtering candidate issues first bysince:(e.g.updated:<now-8d) to reduce the set.
• Using the GraphQL API to batch-fetch onlyassigned/cross-referencedevents for multiple issues in one round-trip.This keeps the job within rate limits while scaling.
Co-authored-by: coderabbitai[bot] <136622811+coderabbitai[bot]@users.noreply.github.com>
|
🎉🎉 Thank you for your contribution! Your PR #142 has been merged! 🎉🎉 |
Summary by CodeRabbit